<?php

namespace App\Console\Commands;

use App\Jobs\FileJob;
use App\Jobs\FileTranslate;
use App\Jobs\GitJob;
use Carbon\Carbon;
use Illuminate\Console\Command;
use phpDocumentor\Reflection\Types\Integer;
use App\Services\GitService;

class FileMonitor extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'file:monitor {project}';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = '监控文件变动并存储到队列中';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return int
     */
    public function handle() : int
    {
        $project = $this->argument("project");
        // $path = '';

        // 1.获取变动的文件
        GitJob::dispatch($project)->delay(Carbon::now()->addSecond(1));
        return 0;
    }
}
